/******************************************************************************
Copyright:
2009 Jens Collin (jens.collin@dinomin.com)

This file is part of Envox Decompiler.

Envox Decompiler is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Envox Decompiler is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with KitchenOS.  If not, see <http://www.gnu.org/licenses/>.

******************************************************************************/
using System;

namespace EnvoxDecompiler
{
	/// <summary>
	/// Summary description for Block_Start.
	/// </summary>
	public class Block_Start : Block
	{

		public override TYPE GetBlockType()
		{
			return TYPE.Start;
		}
		
		/// <summary>
		/// This block is smaller than normal, return smaller size.
		/// </summary>
		/// <returns></returns>
		public override int GetWidth()
		{
			return 64;
		}


		public override string GetXML(int x, int y)
		{
			Trace.Debug("Block_Start::GetXML Started.");	
			// <ScriptStart name="NAME" rect="X 32 96 56" _id="BLOCK_ID" />
            string ret = "\t\t\t<ScriptStart name=\"" + Utils.XmlString(_name) + "\" rect=\"" + x + " " + y + " 96 56\" _id=\"" +
				_blockId + "\">\r\n";
			// This block does not have any inputs, so we don't call the
			// GetInputsXML() method here.
			// <Inputs/>
			ret += "\t\t\t\t<Inputs/>\r\n";
			// call to get outputs
			ret += GetOutputsXML();
			// </ScriptStart>
			ret += "\t\t\t</ScriptStart>\r\n";
			return ret;
		}

		public Block_Start(byte[] rawData) : base(rawData)
		{

			outputErrorIds.Add(new BlockOutput(OUTPUT.Next, 0));
			
			Trace.Debug("Block_Start created.");
			if (_channelDisplayText != "")
			{
				Trace.Debug("Start block can't have description text. Forcing to blank.");
				_channelDisplayText = "";
			}
		}
	}
}
